﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace MTO.Library.Domain
{
    [Table("Products")]
    public class Product
    {
        public Product()
        {
            //Categories = new List<ProductCategory>();
        }

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Column("ProductId")]
        public int ProductId { get; set; }

        [Required(ErrorMessage = "Name must be provided")]
        [StringLength(255, ErrorMessage = "Name must be 255 characters or fewer")]
        public string Name { get; set; }

        /// <summary>
        /// Money is a component, not a separate entity; i.e., the Products table will have column 
        /// for the amount
        /// </summary>
        [DataType("Money")]
        public Money Price { get; set; }

        /// <summary>
        /// many-to-many between Product and ProductCategory
        /// </summary>
        //[Display(Name = "Product Categories")]
        //public virtual IList<ProductCategory> Categories { get; protected set; }
    }
}
